import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        int[] arr1 = Arrays.copyOf(arr,arr.length);
        int count = 0;
        for (int i = 0; i < arr1.length; i++) {
            if((arr1[i] % 2) != 0){
                arr[count] = arr1[i];
                count++;
            }
        }
        for (int i = 0; i < arr1.length; i++) {
            if(arr1[i] % 2 == 0){
                arr[count] = arr1[i];
                count++;
            }

        }
        System.out.println(Arrays.toString(arr));
    }
}